package com.luoc.base.controller;

import com.luoc.base.CancelOrderSender;
import com.luoc.base.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: luoc
 * @Date: 2019/7/23 15:20
 */
@RestController
@RequestMapping("order")
@Api(value = "rabbitmq操作", tags = {"队列模块"})
public class RabbitMqController {

    @Autowired
    private CancelOrderSender cancelOrderSender;

    @GetMapping("/cancelOrder")
    @ApiOperation(value = "取消订单", notes = "必须传orderId")
    public Result cancelOrder(@RequestParam Long orderId) {
        cancelOrderSender.sendMessage(orderId, 1000L);
        return Result.ok(null);
    }

}
